;(function($){
  var flag = ifIE();
  if (flag) {
    getPlaceholderInput();
  }
})(jQuery);
/*获取所有含有placeholder的input框*/
function getPlaceholderInput () {
  var inputArr = document.getElementsByTagName('input'), leng = inputArr.length, i;
  for ( i = 0; i < leng; i += 1 ) {
    var input = inputArr[i];
    var placeholder = input.getAttribute('placeholder');
    if (placeholder !== '') {
      input.setAttribute('placeholder', ''); //避免ie10出现placeholder
      var placeholderDiv = document.createElement('div');
      placeholderDiv.className = 'ie-placeholder';
      placeholderDiv.innerHTML = placeholder;
      input.parentNode.appendChild(placeholderDiv);
      togglePlaceholder(input, placeholderDiv);
    }
  }
}
/*判断是否为ie*/
function ifIE () {
  var broswer = navigator.appName;
  if ( broswer == 'Microsoft Internet Explorer') {
    return true;
  }
  else {
    return false;
  }
}
//点击input框时，对于‘添加’的placeholder进行隐藏或显示
function togglePlaceholder (input, hide) {
  var $input = $(input);
  var $hide = $(hide);
  $hide.on('click', function () {
    $input.focus();
  });
  $input.on({
    'keydown': function () {
      $hide.hide();
    },
    'keyup': function () {
      if (!this.value) {
        $hide.show();
      }
    }
  });
}